<template>
  <div class="m-left">
      <div class="logo">
        <span class="logo-img">Logo</span>
      </div>
    <div id="nav-list">
      <dl class="m-nav" v-for="navItem in parcel" :class="isCurrentTitle(navItem)">
        <dt :class="navItem.icon_class">
          <i class="icon"></i>
          {{navItem.name}}</dt>
        <dd v-for="el in navItem.list" >
          <a :href="el.url" :class="isCurrentItem(el.url)">{{el.name}}</a>
        </dd>
      </dl>
    </div>
  </div>
</template>

<script>
export default {
  name: 'leftBar',
  props:["parcel"],
  data () {
    const navData = [
      {
        name:'店铺管理',
        list:['店铺信息','主题管理','场次设置','优惠设置'],
        className:'shop-bar'
      },
      {
        name:'场次数据',
        list:['场次统计','场次表'],
        className:'session-bar'
      },
      {
        name:'财务报表',
        list:['财务报表','结算配置','交易报表','对账记录'],
        className:'bill-bar'
      },
      {
        name:'玩家数据',
        list:['玩家数据'],
        className:'player-bar'
      },
      {
        name:'进销存管理',
        list:['进货统计','销售数据'],
        className:'sell-bar'
      }
    ];
    return {
      navData:navData,
      currentItem:{
        name:'场次数据',
        value:'场次统计'
      }
    }
  },
  methods:{
    isCurrentTitle(item){
      return item.title == this.currentItem.title ? 'cur':'';
    },
    isCurrentItem(url){
      const pathname = location.pathname;
      return url == pathname? 'cur':'';
    },
    scrollNav(){
      document.addEventListener('scroll',()=>{


      })
    }
  },
  mounted(){

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang = "scss">
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}


.m-left{
  width: 170px;
  /*min-height:790px;*/
  height: 100%;
  background: #363636;
  color: #fff;
  text-align: left;
  padding-bottom:20px;
  float: left;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  .logo{
    width:170px;
    height: 170px;
    background: #212121;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,0.50);
    position: relative;
    &-img{
      background: #FFE579;
      width: 82px;
      height: 82px;
      position:absolute;
      left:44px;
      top:44px;
      line-height:82px;
      overflow: hidden;
      text-align: center;
      -webkit-border-radius: 50%;
      -moz-border-radius: 50%;
      border-radius: 50%;
      color: #000;
    }
  }

  .m-nav{
    dt{
      height: 50px;
      line-height: 50px;
      font-family: PingFangSC-Regular;
      font-size: 16px;
      color: #FFFFFF;
      letter-spacing: 0;
      cursor: pointer;
      .icon{
        display: inline-block;
        margin:0 7px 0 15px;
        width:20px ;
        height: 20px;
        vertical-align: text-bottom;


        background-size: cover;
      }

    }
    dd{
      text-align: center;
      margin:11px 0;
      a{
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #FFFFFF;
        letter-spacing: 0;
        &.cur{
          color:#FFED8C;
        }
      }

    }
  }
  .cur{
    dt{
      background: #212121;
      border-width: 0 0 0 4px;
      border-style: solid;
      border-color: #ffed8c;
    }
  }
  .class1 {
    .icon{
      background: url("../assets/imgs/class1.png") 0 0 no-repeat;
    }
  }
  .class2 {
    .icon{
      background: url("../assets/imgs/class2.png") 0 0 no-repeat;
    }
  }
  .class3 {
    .icon{
      background: url("../assets/imgs/class3.png") 0 0 no-repeat;
    }
  }
  .class4 {
    .icon{
      background: url("../assets/imgs/class4.png") 0 0 no-repeat;
    }
  }
  .class5 {
    .icon{
      background: url("../assets/imgs/class5.png") 0 0 no-repeat;
    }
  }
}

</style>
